fix(weather): use nearest openmeteo hourly data#4123
Merged
khassel merged 1 commit intoMagicMirrorOrg:developfrom Apr 28, 2026
Merged
fix(weather): use nearest openmeteo hourly data#4123khassel merged 1 commit intoMagicMirrorOrg:developfrom
khassel merged 1 commit intoMagicMirrorOrg:developfrom
Conversation
Open-Meteo updates current_weather every 15 min, but hourly data exists only on full hours. Exact timestamp matching could miss and fall back to index 0, causing midnight values in current weather. Pick the last hourly entry at or before current_weather.time, remove dead hourly-shape fallback code, and simplify mapping. Update tests to guard against index-0 fallback and add hourly-type coverage with frozen time. Fixes MagicMirrorOrg#4122
khassel
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open-Meteo updates
current_weatherevery 15 minutes, but the hourly array only has entries at full hours. The old code did an exact timestamp match - so at 14:15, 14:30 or 14:45 it never found a match and silently fell back to index 0, showing midnight values for humidity, feels-like temp, precipitation, etc.Fix:
findLastIndex((hour) => hour.time <= currentMs)- the last hourly entry at or before the current time.While fixing the bug I found several dead branches left over from the #4032 refactor: a path for pre-transposed hourly data that
#parseWeatherApiResponsemakes unreachable, anArray.isArrayguard that's always true, and aLog.debuginside the dead branch. Removing those accounts for most of the ~40 deleted lines - the actual fix is one line.Fixes #4122.